package com.atcumt.redbook;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int[][] nums = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                nums[i][j] = gcdfunc(i + 1, j + 1);
            }
        }
        int[][] sum = new int[n][m];
        sum[0][0] = nums[0][0];

        for (int j = 1; j < nums[0].length; j++) {
            sum[0][j] = nums[0][j] + sum[0][j - 1];
        }

        for (int i = 1; i < nums.length; i++) {
            sum[i][0] = nums[i][0] + sum[i - 1][0];
        }
        for (int i = 1; i < n; i++) {
            for (int j = 1; j < m; j++) {
                sum[i][j] = sum[i][j - 1] + sum[i - 1][j] + nums[i][j] - sum[i - 1][j - 1];
            }
        }
        int total = 0;
        for (int i = k - 1; i < n; i++) {
            for (int j = k - 1; j < m; j++) {
                total += sum[i][j];
                if (i - k >= 0) {
                    total = total - sum[i - k][j];
                }
                if (j - k >= 0) {
                    total = total - sum[i][j - k];
                }
                if (i - k >= 0 && j - k >= 0) {
                    total = total + sum[i - k][j - k];
                }
            }
        }
        System.out.println(total);
        in.close();
    }

    private static int gcdfunc(int m, int n) {
        if (m < n) {
            int k = m;
            m = n;
            n = k;
        }
        if (m % n != 0) {
            int temp = m % n;
            return gcdfunc(n, temp);
        } else
            return n;
    }

}
